home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc International / Development / TSMTEsample⁄1.1 / Source / SamplePart.r < prev    next >
Encoding:
Text File  |  1996-11-14  |  12.0 KB  |  526 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        SamplePart.r
  3.  
  4.     Contains:    SamplePart Resources
  5.  
  6.     Written by:    Steve Smith
  7.  
  8.     Copyright:    © 1994-95 by Apple Computer, Inc., all rights reserved.
  9. */
  10.  
  11. #define SystemSevenOrBetter 1            // we want the extended types
  12. #define    SystemSevenOrLater    1            // Types.r uses this variable
  13.  
  14. // -- MPW Rez Includes --
  15.  
  16. #include "Types.r"
  17. #include "SysTypes.r"
  18. #include "CodeFragmentTypes.r"
  19.  
  20. // -- OpenDoc Includes --
  21.  
  22. #ifndef __ODTYPES_R__
  23. #include "ODTypes.r"
  24. #endif
  25.  
  26. #ifndef SOM_Module_OpenDoc_StdDefs_defined
  27. #include "StdDefs.r"
  28. #endif
  29.  
  30. // -- SamplePart Includes --
  31.  
  32. #ifndef _SAMPLEPARTDEF_
  33. #include "SamplePartDef.h"
  34. #endif
  35.  
  36. #ifndef _SAMPLEPARTVERS_
  37. #include "SamplePartVers.h"
  38. #endif
  39.  
  40. //-------------------------------------------------------------------------------------
  41. // .rsrc resources
  42. //-------------------------------------------------------------------------------------
  43.  
  44. // SamplePart - This gets the resources from my .rsrc file (PICTs etc.)
  45. include "SamplePartOtherResources.rsrc";
  46.  
  47. //-------------------------------------------------------------------------------------
  48. // Finder Version Resources
  49. //-------------------------------------------------------------------------------------
  50.  
  51. // Part's Finder Version Resource
  52.  
  53. resource 'vers' (1) {
  54.     currentMajorVersion,
  55.     finderMinorVersion,
  56.     developmentStage,
  57.     preReleaseNumber,
  58.     verUS,
  59.     shortVersionStr,
  60.     shortVersionStr", © Apple Computer, Inc. 1994-1995"
  61. };
  62.  
  63. resource 'vers' (2) {
  64.     currentMajorVersion,
  65.     finderMinorVersion,
  66.     developmentStage,
  67.     preReleaseNumber,
  68.     verUS,
  69.     shortVersionStr,
  70.     "OpenDoc™ Sample Code"
  71. };
  72.  
  73. //-------------------------------------------------------------------------------------
  74. // Code Fragment Resources
  75. //-------------------------------------------------------------------------------------
  76.  
  77. resource 'cfrg' (0) {
  78.     {    /* [1] */
  79. #ifdef _68KBUILD_
  80.         kMotorola,
  81. #else
  82.         kPowerPC,
  83. #endif
  84.         kFullLib,
  85.         currentVersion,
  86.         compatibleVersion,
  87.         kDefaultStackSize,
  88.         kNoAppSubFolder,
  89.         kIsLib,
  90.         kOnDiskFlat,
  91.         kZeroOffset,
  92.         kWholeFork,
  93.         kSamplePartID,        /* This must be the class ID. */
  94.         /* [2] */
  95. #ifdef _68KBUILD_
  96.         kMotorola,
  97. #else
  98.         kPowerPC,
  99. #endif
  100.         kFullLib,
  101.         currentVersion,
  102.         compatibleVersion,
  103.         kDefaultStackSize,
  104.         kNoAppSubFolder,
  105.         kIsLib,
  106.         kOnDiskFlat,
  107.         kZeroOffset,
  108.         kWholeFork,
  109.         kPartClassName        /* This must be the SOM class name */
  110.                             /* for this part.                   */
  111.     }
  112. };
  113.  
  114. //-------------------------------------------------------------------------------------
  115. // NMAP Resources
  116. //-------------------------------------------------------------------------------------
  117.  
  118. // Map a part's class id (module::classname)
  119. // to a part's kind (unique content identifier)
  120. //
  121. resource kODNameMappings (kEditorKindMapId) {
  122.     kODEditorKinds,
  123.     {    /* array Types: 1 elements */
  124.         /* [1] */
  125.         kSamplePartID,
  126.         kODIsAnISOStringList
  127.         {
  128.             {    /* array ClassIDs: 1 elements */
  129.                 /* [1] */
  130.                 kSamplePartKind
  131.             }
  132.         }
  133.     }
  134. };
  135.  
  136. // Map a part's class id (module::classname)
  137. // to a human readable string.
  138. //
  139. resource kODNameMappings (kEditorUserStringMapId) {
  140.     kODEditorUserString,
  141.     {    /* array Types: 1 elements */
  142.         /* [1] */
  143.         kSamplePartID,
  144.         kODIsINTLText
  145.         {
  146.             smRoman,
  147.             langEnglish,
  148.             kSamplePartEditorUserString
  149.         }
  150.     }
  151. };
  152.  
  153. // Map a part's kind (unique content identifier)
  154. // to a generic content category identifier.
  155. //
  156. resource kODNameMappings (kKindCategoryMapId) {
  157.     kODKind,
  158.     {    /* array Types: 1 elements */
  159.         /* [1] */
  160.         kSamplePartKind,
  161.         kODIsAnISOStringList
  162.         {
  163.             {    /* array ClassIDs: 1 elements */
  164.                 /* [1] */
  165.                 kSamplePartCategory
  166.             }
  167.         }
  168.     }
  169. };
  170.  
  171. // Map a part's kind (unique content identifier)
  172. // to a human readable string.
  173. //
  174. resource kODNameMappings (kKindUserStringMapId) {
  175.     kODKindUserString,
  176.     {    /* array Types: 1 elements */
  177.         /* [1] */
  178.         kSamplePartKind,
  179.         kODIsINTLText
  180.         {
  181.             smRoman,
  182.             langEnglish,
  183.             kSamplePartKindUserString
  184.         }
  185.     }
  186. };
  187.  
  188. // Map a part's generic content category identifier
  189. // to a human readable string.
  190. //
  191. resource kODNameMappings (kCategoryUserStringMapId) {
  192.     kODCategoryUserString,
  193.     {    /* array KeyList: 1 elements */
  194.         /* [1] */
  195.         kSamplePartCategory,
  196.         kODIsINTLText {
  197.             smRoman,
  198.             langEnglish,
  199.             kSamplePartCategoryUserString
  200.         }
  201.     }
  202. };
  203.  
  204. // Map a part's kind (unique content identifier)
  205. // to an old style MacOS Type (and/or ScrapType).
  206. //
  207. resource kODNameMappings (kOldMacOSTypeMapId) {
  208.     kODKindOldMacOSType,
  209.     {    /* array KeyList: 1 elements */
  210.         /* [1] */
  211.         kSamplePartKind,
  212.         kODIsMacOSType {
  213.             kSamplePartDocumentOSType
  214.         }
  215.     }
  216. };
  217.  
  218. //-------------------------------------------------------------------------------------
  219. // OLE Interoperability Support
  220. //-------------------------------------------------------------------------------------
  221.  
  222. // This resource allows your editor to be registered with the OLE runtime on the
  223. // Macintosh and subsequently interoperate with OLE clients/servers. Contact Microsoft
  224. // to acqiure a unique class ID.
  225. resource 'olcr' (0, "OLE Class ID")
  226. {
  227.    "{80C11F40-7503-8576-00D01113F11}"; /* your part's CLSID */
  228. };
  229.  
  230. //-------------------------------------------------------------------------------------
  231. // String List Resources
  232. //-------------------------------------------------------------------------------------
  233.  
  234. resource 'STR#' (kMenuStringResID, "Menu Items strings") {
  235.     {    /* array StringArray: 3 elements */
  236.         /* [1] */
  237.         "About SamplePart…",
  238.         /* [2] */
  239.         "PART",
  240.         /* [3] */
  241.         "Sample • Sample"
  242.     }
  243. };
  244.  
  245. resource 'STR#' (kErrorStringResID, "Error strings") {
  246.     {    /* array StringArray: 6 elements */
  247.         /* [1] */
  248.         "“SamplePart” was unable completely initi"
  249.         "alize its internal structures.",
  250.         /* [2] */
  251.         "“SamplePart” was unable to open the docu"
  252.         "ment due to unforseen circumstances.",
  253.         /* [3] */
  254.         "“SamplePart” was unable to open a part w"
  255.         "indow due to unforseen circumstances.",
  256.         /* [4] */
  257.         "“SamplePart” has been asked to remove a "
  258.         "frame that does not belong to it, or an "
  259.         "error occurred while removing the frame "
  260.         "from internal storage.",
  261.         /* [5] */
  262.         "A window that “SamplePart” created has b"
  263.         "een deleted without its knowledge. This "
  264.         "may generate a fatal error in the near f"
  265.         "uture. Please close the document immedia"
  266.         "tely to prevent data loss.",
  267.         /* [6] */
  268.         "“SamplePart” encountered a fatal error w"
  269.         "hile trying to save. Try saving again or"
  270.         " closing the document."
  271.     }
  272. };
  273.  
  274. //-------------------------------------------------------------------------------------
  275. // Finder Related Resources
  276. //-------------------------------------------------------------------------------------
  277.  
  278. // Kind resources affect the text Finder displays in the
  279. // "kind" column and file info dialog. This feature was
  280. // introduced as part of Macintosh Easy Open.
  281. //
  282. resource 'kind' (kBaseResourceID) {
  283.     kSamplePartEditorOSType,
  284.     0, /* region = USA */
  285.     {
  286.         'shlb', "OpenDoc™ editor"
  287.     }
  288. };
  289.     
  290. resource 'kind' (kBaseResourceID+1) {
  291.     kSamplePartViewerOSType,
  292.     0, /* region = USA */
  293.     {
  294.         'shlb', "OpenDoc™ viewer"
  295.     }
  296. };
  297.     
  298. resource 'kind' (kBaseResourceID+2) {
  299.     kODShellSignature,
  300.     0, /* region = USA */
  301.     {
  302.         kSamplePartDocumentOSType, "SamplePart 1.1 document",
  303.         kSamplePartStationeryOSType, "SamplePart 1.1 stationery"
  304.     }
  305. };
  306.  
  307. // The -16397 string will be displayed by Finder when a user
  308. // tries to open the editor shared library. The string should
  309. // give the user a little detail about the part's capabilities
  310. // and enough information to install the part in the correct location.
  311. //
  312. resource 'STR ' (-16397, purgeable) {
  313.     "OpenDoc™ editor\n\n“SamplePart” demonstrates the functionality of a very "
  314.     "basic part. To work properly, it should be placed in the Editors folder. "
  315.     "To create a new document, open a stationery pad."
  316. };
  317.  
  318. //-------------------------------------------------------------------------------------
  319. // Dialog Resources
  320. //-------------------------------------------------------------------------------------
  321.  
  322. resource 'DLOG' (kAboutBoxID, "SamplePart About Box") {
  323.     {0, 0, 250, 350},
  324.     dBoxProc,
  325.     invisible,
  326.     goAway,
  327.     0x0,
  328.     kAboutBoxID,
  329.     "",
  330.     alertPositionMainScreen
  331. };
  332.  
  333. resource 'DITL' (kAboutBoxID) {
  334.     {    /* array DITLarray: 8 elements */
  335.         /* [1] */
  336.         {222, 270, 242, 338}, Button { enabled, "OK" },
  337.         /* [2] */
  338.         {24, 25, 56, 57}, Icon { disabled, kEditorIconPicture },
  339.         /* [3] */
  340.         {13, 68, 237, 69}, Button { disabled, "" },
  341.         /* [4] */
  342.         {64, 13, 65, 337}, Button { disabled, "" },
  343.         /* [5] */
  344.         {46, 76, 62, 172}, StaticText { disabled, "SamplePart" },
  345.         /* [6] */
  346.         {76, 76, 116, 304}, StaticText { disabled,
  347.             "SamplePart is a sample part editor which"
  348.             " illustrates the functionality of a basi"
  349.             "c part editor." },
  350.         /* [7] */
  351.         {124, 76, 152, 304}, StaticText { disabled,
  352.             "Written by Steve Smith with support from"
  353.             " the OpenDoc™ Engineering team." },
  354.         /* [8] */
  355.         {172, 76, 200, 300}, StaticText { disabled,
  356.             "Copyright© 1994 - 1996 by Apple Computer, "
  357.             "Inc. All Rights Reserved." },
  358.         /* [9] */
  359.         {51, 272, 64, 340}, StaticText { disabled,
  360.             "Version "shortVersionStr }
  361.     }
  362. };
  363.  
  364. resource 'dctb' (kAboutBoxID) {
  365.     /* dialog background fill color */
  366.     {    /* array ColorSpec: 5 elements */
  367.         /* [1] */
  368.         wContentColor, 59127, 59127, 59127,
  369.         /* [2] */
  370.         wFrameColor, 0, 0, 0,
  371.         /* [3] */
  372.         wTextColor, 0, 0, 0,
  373.         /* [4] */
  374.         wHiliteColor, 0, 0, 0,
  375.         /* [5] */
  376.         wTitleBarColor, 65535, 65535, 65535
  377.     }
  378. };
  379.  
  380. data 'ictb' (kAboutBoxID) {
  381.     /* dialog control text styling */
  382.     $"0000000000000000002800240028"
  383.     $"004C80070074800700888007009C"
  384.     $"800700B0800700C4000000000000"
  385.     $"000300007FFF7FFF7FFF0001FFFF"
  386.     $"FFFFFFFF00020000000000000003"
  387.     $"FFFFFFFFFFFF0000000000000003"
  388.     $"00007FFF7FFF7FFF0001FFFFFFFF"
  389.     $"FFFF00020000000000000003FFFF"
  390.     $"FFFFFFFF00D80100000E00000000"
  391.     $"0000FFFFFFFFFFFF000000E10000"
  392.     $"0009000000000000FFFFFFFFFFFF"
  393.     $"000000E800000009000000000000"
  394.     $"FFFFFFFFFFFF000000EF00000009"
  395.     $"000000000000FFFFFFFFFFFF0000"
  396.     $"00F600000009000000000000FFFF"
  397.     $"FFFFFFFF00000850616C6174696E"
  398.     $"6F0647656E6576610647656E6576"
  399.     $"610647656E6576610647656E6576"
  400.     $"61"
  401. };
  402.  
  403. resource 'DLOG' (kErrorBoxID, "SamplePart Error Box") {
  404.     {57, 46, 244, 374},
  405.     dBoxProc,
  406.     invisible,
  407.     goAway,
  408.     0x0,
  409.     kErrorBoxID,
  410.     "",
  411.     alertPositionParentWindowScreen
  412. };
  413.  
  414. resource 'DITL' (kErrorBoxID) {
  415.     {    /* array DITLarray: 5 elements */
  416.         /* [1] */
  417.         {153, 256, 173, 314}, Button { enabled, "OK" },
  418.         /* [2] */
  419.         {153, 185, 173, 243}, Button { enabled, "Cancel" },
  420.         /* [3] */
  421.         {11, 70, 124, 317}, StaticText { disabled,
  422.             "<< Use this for errors in the Editor, su"
  423.             "ch as out of memory, unable to acquire s"
  424.             "ome system resource, etc.>> \nUser errors"
  425.             " use a standard alert appearance. See DI"
  426.             "TL 129.>>" },
  427.         /* [4] */
  428.         {11, 19, 43, 51}, Icon { disabled, kEditorIconPicture },
  429.         /* [5] */
  430.         {149, 252, 177, 318}, UserItem { disabled }
  431.     }
  432. };
  433.  
  434. //-------------------------------------------------------------------------------------
  435. // Finder Bundle Information
  436. //-------------------------------------------------------------------------------------
  437.  
  438. resource 'BNDL' (kDocumentBundle, "Document BNDL") {
  439.     kODShellSignature,
  440.     0,
  441.     {    /* array TypeArray: 2 elements */
  442.         /* [1] */
  443.         'FREF',
  444.         {    /* array IDArray: 2 elements */
  445.             /* [1] */
  446.             0, kDocumentFREF,
  447.             /* [2] */
  448.             1, kStationeryFREF
  449.         },
  450.         /* [2] */
  451.         'ICN#',
  452.         {    /* array IDArray: 2 elements */
  453.             /* [1] */
  454.             0, kDocumentIcons,
  455.             /* [2] */
  456.             1, kStationeryIcons
  457.         }
  458.     }
  459. };
  460.  
  461. resource 'BNDL' (kEditorBundle, "Editor BNDL") {
  462.     kSamplePartEditorOSType,
  463.     0,
  464.     {    /* array TypeArray: 2 elements */
  465.         /* [1] */
  466.         'FREF',
  467.         {    /* array IDArray: 1 elements */
  468.             /* [1] */
  469.             0, kEditorFREF
  470.         },
  471.         /* [2] */
  472.         'ICN#',
  473.         {    /* array IDArray: 1 elements */
  474.             /* [1] */
  475.             0, kEditorIcons
  476.         }
  477.     }
  478. };
  479.  
  480. resource 'BNDL' (kViewerBundle, "Viewer BNDL") {
  481.     kSamplePartViewerOSType,
  482.     0,
  483.     {    /* array TypeArray: 2 elements */
  484.         /* [1] */
  485.         'FREF',
  486.         {    /* array IDArray: 1 elements */
  487.             /* [1] */
  488.             0, kViewerFREF
  489.         },
  490.         /* [2] */
  491.         'ICN#',
  492.         {    /* array IDArray: 1 elements */
  493.             /* [1] */
  494.             0, kViewerIcons
  495.         }
  496.     }
  497. };
  498.  
  499. resource 'FREF' (kDocumentFREF) {
  500.     kSamplePartDocumentOSType, 0, ""
  501. };
  502.  
  503. resource 'FREF' (kStationeryFREF) {
  504.     kSamplePartStationeryOSType, 1, ""
  505. };
  506.  
  507. resource 'FREF' (kEditorFREF) {
  508.     'shlb', 0, ""
  509. };
  510.  
  511. resource 'FREF' (kViewerFREF) {
  512.     'shlb', 0, ""
  513. };
  514.  
  515. data kODShellSignature (0, "Owner resource") {
  516.     $"00"
  517. };
  518.  
  519. data kSamplePartViewerOSType (0, "Owner resource") {
  520.     $"00"
  521. };
  522.  
  523. data kSamplePartEditorOSType (0, "Owner resource") {
  524.     $"00"
  525. };
  526.